<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/context/mytags.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>取消</title>
    <t:base type="jquery,easyui,tools,DatePicker"></t:base>
    <script type="text/javascript" src="plug-in/ckfinder/ckfinder.js"></script>
    <link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css"/>
    <script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.min.js"></script>
</head>
<body>
<t:formvalid formid="formobj" action="" dialog="false" usePlugin="password" layout="table" tiptype="3"
             refresh="false">
    <table class="nobordertable noborder" style="border: none;">
        <input type="hidden" value="${cbsService.id}" name="cbsServiceId" id="cbsServiceId"/>
        <tbody>
        <tr>
            <td class="al_r" width="20%" valign="top">
                <label>处理描述:</label>
            </td>
            <td width="80%">
                <textarea style="width: 100%; height: 80px;" id="remark" maxlength="500"
                          datatype="*1-500" nullMsg="请填写处理描述">${cbsService.cancelRemark}</textarea>
            </td>
        </tr>
        <tr>
            <td colspan="2" style="text-align: center;">
                <a href="#" class="easyui-linkbutton l-btn" id="submitBtn1" onclick="submit()">确认</a>
            </td>
        </tr>
        </tbody>
    </table>
</t:formvalid>
</body>
</html>
<script type="text/javascript">
    var form = $("#formobj").Validform({
        ignoreHidden: true,
        postonce: true,
        showAllError: true,
        ajaxPost: true,
        tiptype: 3,
        beforeSubmit: function () {
            submit();
        }
    });

    $("#submitBtn1").click(function () {
        submit();
    });

    function submit() {
        var id = '${cbsService.id}';
        var sn = '${cbsService.sn}';
        var code = '${cbsService.code}';

        //调用formValidata 进行验证，并能阻止提交
        if (!form.check(false)) {
            form.submitForm(false);
            return false;
        }

        $.ajax({
            url: "cbsServiceController.do?subCancelInfo",
            data: {
                "id": $("#cbsServiceId").val(),
                "remark": $("#remark").val()
            },
            cache: false,
            dataType: 'json',
            type: 'POST',
            async: false,
            success: function (data) {
                lockmask(false);
                window.top.$("#maintabs").tabs({
                    title: "编辑服务单" + data.obj,
                    onBeforeClose: function (title, index) {
                    }
                });
                window.top.$("#maintabs").tabs('close', "编辑服务单" + data.obj);
                addOneTab("服务单管理", "cbsServiceController.do?cbsService");
                frameElement.api.close();
            }
        });
    }
</script>
